﻿@model dynamic

@{
    ViewBag.Title = "Upload files";
}



<h2>Upload files</h2>


<div id="status-message">Please select files for uploading (max size 10 MB)</div>
<div id="custom-queue" style="overflow : auto;"></div>
<input id="custom_file_upload" type="file" name="Filedata" />        



@section xscripts
{
    <link href="../../Content/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
    
    <script type="text/javascript" src="../../Content/uploadify/swfobject.js"></script>
    <script type="text/javascript" src="../../Content/uploadify/jquery.uploadify.v2.1.4.js"></script>

    <script type="text/javascript">
        var auth = "@(Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value)";
        var ASPSESSID = "@Session.SessionID";
       
        var path = "/Content/uploadify";
        var ulpoadScript = "/Files/UploadFiles/";
        var galleryEditorPath = "/Editor/PhotogalleryEditor/";
        $(document).ready(function () {
            $('#custom_file_upload').uploadify({
                'uploader': '/Content/uploadify/uploadify.swf',
                'script': ulpoadScript,
                'cancelImg': path + '/cancel.png',
                'folder': '/uploads',
                'multi': true,
                'auto': true,
                'fileExt': '*',
                'fileDesc': 'All files',
                'queueID': 'custom-queue',
                'queueSizeLimit': 500,
                'scriptData': { ASPSESSID: ASPSESSID, AUTHID: auth, xgallerykey: "exist"},
                'simUploadLimit': 1,
                'removeCompleted': true,
                'onSelectOnce': function (event, data) {
                    $('#status-message').text(data.filesSelected + ' files have been added to the queue.');
                },
                'onAllComplete': function (event, data) {
                    $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
                    $('#fotogalleryId').load(galleryEditorPath);
                }
            });
        });

        $(document).ready(function() {
    //        $('#fotogalleryId').load(galleryEditorPath);
        });
    </script> 

    <style type="text/css"> 
    #custom-demo .uploadifyQueueItem {
      background-color: #FFFFFF;
      border: none;
      border-bottom: 1px solid #E5E5E5;
      font: 11px Verdana, Geneva, sans-serif;
      height: 30px;
      margin-top: 0;
      padding: 10px;
      width: 350px;
    }

    #custom-demo .uploadifyError {
      background-color: #FDE5DD !important;
      border: none !important;
      border-bottom: 1px solid #FBCBBC !important;
    }

    #custom-demo .uploadifyQueueItem .cancel {
      float: right;
    }

    #custom-demo .uploadifyQueue .completed {
      color: #C5C5C5;
    }

    #custom-demo .uploadifyProgress {
      background-color: #E5E5E5;
      margin-top: 10px;
      width: 100%;
    }

    #custom-demo .uploadifyProgressBar {
      background-color: #0099FF;
      height: 3px;
      width: 1px;
    }

    #custom-demo #custom-queue {
      border: 1px solid #E5E5E5;
      height: 213px;
    margin-bottom: 10px;
      width: 570px;
    }			
    </style> 
}
